const app=getApp()

Page({
  data () {
    return {
      code:'',
      data:{}
    }
  },
  onLoad() {
    app.token && this.getUserprofile()
  },
  async getUserprofile(){
    const {code,data:{avatar,nickName}}=await wx.http.get('/userInfo')
    if(code!==10000)return wx.utils.toast()
    this.setData({avatar,nickName})
  },
  goLogin() {
    wx.navigateTo({
      url: '/pages/login/index',
    })
  },
})